package com.bf.electroplating.controller.front;

import com.bf.electroplating.pojo.vo.ResultVO;
import com.bf.electroplating.pojo.vo.rain.*;
import com.bf.electroplating.service.IFrontRainService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * 前端雨水管网图环保管理驾驶舱数据控制器
 * 提供雨水管网图驾驶舱各个模块的数据接口
 */
@RestController
@RequestMapping("/api/front/rain")
@Tag(name = "前端雨水管网图环保管理驾驶舱", description = "前端雨水管网图环保管理驾驶舱相关接口")
public class FrontRainController {

    @Autowired
    private IFrontRainService frontRainService;

    /**
     * 1. 园区概况数据
     * 提供园区基本信息、企业数量、车间数量、产线数量等统计
     */
    @GetMapping("/park-overview")
    @Operation(summary = "获取园区概况数据")
    public ResultVO<ParkOverviewDataVO> getParkOverviewData() {
        ParkOverviewDataVO data = frontRainService.getParkOverviewData();
        return ResultVO.ok(data);
    }

    /**
     * 2. 预警处置数据
     * 提供预警总数、已处置、未处置统计及详细列表
     */
    @GetMapping("/alarm-handling")
    @Operation(summary = "获取预警处置数据")
    public ResultVO<RainAlarmHandlingDataVO> getAlarmHandlingData() {
        RainAlarmHandlingDataVO data = frontRainService.getAlarmHandlingData();
        return ResultVO.ok(data);
    }

    /**
     * 3. 设备数量统计
     * 提供总设备数、在线设备数、离线设备数统计
     */
    @GetMapping("/device-statistics")
    @Operation(summary = "获取设备数量统计数据")
    public ResultVO<DeviceStatisticsDataVO> getDeviceStatistics() {
        DeviceStatisticsDataVO data = frontRainService.getDeviceStatistics();
        return ResultVO.ok(data);
    }

    /**
     * 4. 入河排口数据
     * 提供多个排口的监控数据、闸阀状态、PH值和电导率趋势
     */
    @GetMapping("/river-outlets")
    @Operation(summary = "获取入河排口数据")
    public ResultVO<RiverOutletsDataVO> getRiverOutletsData(@RequestParam(defaultValue = "1") int outletId) {
        RiverOutletsDataVO data = frontRainService.getRiverOutletsData(outletId);
        return ResultVO.ok(data);
    }

    /**
     * 5. 园区应急池数据
     * 提供应急池和初雨池的液位监控、容积信息
     */
    @GetMapping("/emergency-pool")
    @Operation(summary = "获取园区应急池数据")
    public ResultVO<EmergencyPoolDataVO> getEmergencyPoolData(@RequestParam(defaultValue = "emergency") String poolType) {
        EmergencyPoolDataVO data = frontRainService.getEmergencyPoolData(poolType);
        return ResultVO.ok(data);
    }

    /**
     * 6. 地图导航数据
     * 提供园区企业、雨水管网图、在线监控的切换功能数据
     */
    @GetMapping("/map-navigation")
    @Operation(summary = "获取地图导航数据")
    public ResultVO<MapNavigationDataVO> getMapNavigationData(@RequestParam(defaultValue = "enterprises") String viewType) {
        MapNavigationDataVO data = frontRainService.getMapNavigationData(viewType);
        return ResultVO.ok(data);
    }

    /**
     * 7. 实时监控数据
     * 提供实时数据更新和状态监控
     */
    @GetMapping("/realtime-monitoring")
    @Operation(summary = "获取实时监控数据")
    public ResultVO<RealtimeMonitoringDataVO> getRealtimeMonitoringData() {
        RealtimeMonitoringDataVO data = frontRainService.getRealtimeMonitoringData();
        return ResultVO.ok(data);
    }

    /**
     * 8. 综合态势数据
     * 提供整个园区的综合态势感知数据
     */
    @GetMapping("/comprehensive-situation")
    @Operation(summary = "获取综合态势数据")
    public ResultVO<ComprehensiveSituationDataVO> getComprehensiveSituationData() {
        ComprehensiveSituationDataVO data = frontRainService.getComprehensiveSituationData();
        return ResultVO.ok(data);
    }
}

